package com.hxzy.shop.member.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hxzy.shop.entity.Label;
import com.hxzy.shop.entity.LabelInnerMember;
import com.hxzy.shop.member.dto.label.req.LabelListsReq;
import com.hxzy.shop.member.dto.label.resp.LabelListsResp;
import com.hxzy.shop.member.dto.member.req.MemberDetailsReq;
import com.hxzy.shop.member.dto.member.resp.MemberLabelResp;
import com.hxzy.shop.member.mapper.LabelInnerMemberMapper;
import com.hxzy.shop.member.mapper.LabelMapper;
import com.hxzy.shop.member.service.LabelInnerMemberService;
import com.hxzy.shop.member.service.LabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author admin
* @description 针对表【back_label(中台标签表)】的数据库操作Service实现
* @createDate 2023-08-04 13:47:40
*/
@Service
public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label>
    implements LabelService {

    @Autowired
    private LabelMapper labelMapper;

    @Autowired
    private LabelInnerMemberMapper labelInnerMemberMapper;

    @Override
    public PageInfo<LabelListsResp> labelLists(LabelListsReq req) {
        return PageHelper.startPage(req.getPageNumber(),req.getPageSize())
                .doSelectPageInfo(() -> labelMapper.findallbyLabelLists(req));
    }

    @Override
    public List<MemberLabelResp> getMemberLabel(MemberDetailsReq req) {
        return labelInnerMemberMapper.getMemberLabel(req);
    }


}




